<?php

namespace App\Http\Requests\Frontend\V10\Common;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class uploadRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'file'=>'required',
            'path'=>['required',Rule::in(config('common.frontend_path'))],
            'type'=>[Rule::in(config('common.frontend_upload_type'))],
        ];
    }

    public function messages()
    {
        return [
            'file.required'=>'请选择上传文件',
            'path.required'=>'缺少上传路径',
            'path.in'=>'上传路径不在可以范围内',
            'type.in'=>'上传内容类型不在可以范围内'
        ];
    }
}
